package com.jiaanpei.frameproject.manage;

import android.content.Context;
import android.util.Log;
import android.view.View;

import com.jiaanpei.frameproject.app.Constants;
import com.jiaanpei.frameproject.utils.SpUtil;
import com.umeng.analytics.MobclickAgent;
import com.umeng.message.PushAgent;
import com.umeng.message.UTrack;

import java.util.List;

public class UserManager {
    public static void clearUser(Context context){
        MobclickAgent.onProfileSignOff();
        SpUtil.putString(context, Constants.USERID, "");
        SpUtil.putString(context, Constants.PASS_WORD, "");
        SpUtil.putString(context, Constants.ACCESSTOKEN, "");
        SpUtil.putString(context, Constants.USERNAME, "");
    }

    public static void saveUser(Context context, String loginName, String loginPassWord, String accessToken,PushAgent mPushAgent){
        //存储用户名

        SpUtil.putString(context, Constants.USERNAME, loginName);
        SpUtil.putString(context, Constants.PASS_WORD, loginPassWord);
        SpUtil.putString(context, Constants.ACCESSTOKEN, accessToken);
        mPushAgent.addAlias(SpUtil.getString(context, Constants.USERID, ""), Constants.ALIAS, new UTrack.ICallBack() {
            @Override
            public void onMessage(boolean isSuccess, String message) {//SpUtil.getString(getApplicationContext(), Constants.USERNAME, "")
                Log.i("isSuccessadd",isSuccess+message);
            }
        });

    }




}
